package cn.dengta.webapp.trade.form;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import me.codeplayer.util.StringUtil;
import me.codeplayer.util.X;

/**
 * 保存adjust查询到的的渠道成本
 *
 * @author wxm
 * @since 2022/6/21 23:39
 */
@Setter
@Getter
@Accessors(chain = true)
public class CostVO implements Serializable {

	private static final long serialVersionUID = 1L;

	public String name;
	public String campaignName;

	public String getCampaignName() {
		return AdjustDTO.clipCampaignName(name);
	}

	public String toUpperCaseCampaign() {
		String campaignName = getCampaignName();
		return StringUtil.notEmpty(campaignName) ? campaignName.toUpperCase() : campaignName;
	}

	public String token;
	public BigDecimal cost;
	public List<String> kpi_values;

	public BigDecimal getCost() {
		if (X.isValid(kpi_values)) {
			return new BigDecimal(kpi_values.get(0));
		}
		return BigDecimal.ZERO;
	}

}
